<!-- 网点查询 -->
<template>
	<view class="">
		<view class="seek">
		<u-search placeholder="请输入关键字" v-model="keyword" custom @change="searchBranches"></u-search>

		</view>
		<view class="branchee" @click="handleItemClick(item)" v-for="(item,index) in arr" :key="index">
			<view class="">
				<svg t="1692253835248" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="7594" width="20" height="20">
					<path
						d="M730.001059 142.376685C674.219615 92.668563 596.796268 65.290005 512 65.290005S349.780385 92.668563 293.998941 142.376685c-67.034742 59.736523-102.464673 150.544715-102.464673 262.620279 0 244.113787 280.928251 530.164708 292.88763 542.222325 7.29208 7.354502 17.22122 11.488659 27.577079 11.488659 10.355859 0 20.284999-4.13518 27.577079-11.488659 11.95938-12.05864 292.88763-298.108538 292.88763-542.222325C832.465732 292.921399 797.035802 202.113207 730.001059 142.376685zM511.967254 862.912162c-26.241664-29.129434-67.722404-77.68429-109.032252-136.26857C315.459718 602.581018 269.222651 491.358891 269.222651 404.996964c0-243.122203 185.824219-262.018575 242.776326-262.018575 225.270627 0 242.776326 200.551642 242.776326 262.018575C754.776326 575.98529 580.826552 786.352485 511.967254 862.912162zM512.00921 232.834906c-85.246523 0-154.60417 70.452585-154.60417 157.056012s69.357648 157.054989 154.60417 157.054989c85.256756 0 154.618497-70.451562 154.618497-157.054989S597.265966 232.834906 512.00921 232.834906zM512.00921 478.968699c-47.768957 0-86.626963-39.95806-86.626963-89.077781s38.858006-89.078805 86.626963-89.078805c47.77305 0 86.641289 39.959084 86.641289 89.078805S559.78226 478.968699 512.00921 478.968699z"
						p-id="7595"
						fill="#8a8a8a"
					></path>
				</svg>
			</view>
			<view class="branche">
				<view class="branche_name">
					<view class="name1">{{item.title}}</view>
					<view class="name2">营业中</view>
				</view>
				<view class="branche_mi">
					<view class="mi1">{{item.distance}}</view>
					<view class="mi2 ">|</view>
					<view class="mi3">{{item.place}}</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import {keepy} from "../../API/server.js"

export default {
	data() {
		return {
			arr:[],
			keyword: ''
			
		};
	},
	methods:{
		
		onShow() {
			this.branche();
		
		},
		branche() {
			keepy()
				.then((res) => {
					// console.log(res);
					this.arr = res.data.data;
				})
				.catch((error) => {
					console.error(error);
				});
		},
		handleItemClick(item) {
		  console.log('Clicked item:', item);
		    uni.navigateTo({
		      url: '/pages/branch/branch?data=' + JSON.stringify(item)
		    });
		  // 在这里进行处理，您可以将 item 存储到 Vuex、本地存储，或者传递给另一个组件等等
		},
		
		//网点搜索
	   searchBranches() {
	        uni.request({
	          url: "http://172.16.105.51:8000/branchSearch",
	          method: "POST",
	          data: {
	            keyword: this.keyword,
	          },
	          header: {
	            "Content-Type": "application/json",
	          },
	          success: (res) => {
	            this.arr = res.data.serve; // 假设结果的键为"serve"
				
	          },
	          fail: (error) => {
	            console.error("Error:", error);
	          },
	        });
	      },

		
	   



		 
	}
};
</script>

<style scoped>
.branchee {
	height: 120rpx;
	display: flex;
	justify-content: flex-start;
	align-items: center;
	border-bottom: 1rpx solid #adadad;
	width: 710rpx;
	margin-left: 20rpx;
	margin-top: 30rpx;
}
.branche{
	margin-left: 20rpx;

}
.branche_name{
	display: flex;
}
.name1{
	color: #000000;
	font-size: 32rpx;
}
.name2{
	color: #0e932e;
	border: 1rpx solid  #0e932e;
	margin-left: 10rpx;
}
.branche_mi{
	display: flex; 
	margin-top: 10rpx;
}
.mi1{
	font-size: 20rpx;
}
.mi2{
	font-size: 20rpx;
	margin-left: 10rpx;
}
.mi3{
	font-size: 20rpx;
	margin-left: 10rpx;
}
</style>
